$(function(){
    $('#btnApprove').click(function(e){
        var baseurl = $(this).attr('baseurl');
        var page = $(this).attr('page');
        var bid = $(this).attr('bid');

        $('#frmAct').attr('action',baseurl+'/backend/booking/'+page);
        $('#frmAct #id').val(bid)
        $('#frmAct #act').val('approve');
        document.frmAct.submit();
    });

    $('#btnCancel').click(function(e){
        var baseurl = $(this).attr('baseurl');
        var page = $(this).attr('page');
        var bid = $(this).attr('bid');

        var reason = prompt('Please insert your cancelation reason','');
        if(reason==null || reason==''){
            return;
        }

        $('#frmAct').attr('action',baseurl+'/backend/booking/'+page);
        $('#frmAct #id').val(bid)
        $('#frmAct #act').val('cancel');
        $('#frmAct #reason').val(reason);
        document.frmAct.submit();
    });
});